<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>临时费用-详细</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/dist/plugins/webuploader-0.1.5/webuploader.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=f5a12a1d">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style type="text/css">
        .user {
            height: 30px;
            line-height: 30px;
            max-height: 30px;
            float: left;
            text-align: left;
            min-width: 32px;
            padding-left: 1px;
            overflow: hidden;
            cursor: pointer;
        }

        .user:hover {
            background-color: #cfd4d1;
        }

        .userbox .select.user {
            color: #fff;
            background-color: #045B9E;
        }

        .span-btn {
            position: absolute;
            left: 10px;
            margin-top: 4px;
            cursor: pointer;
        }

        .auditorName {
            text-align: center;
        }

        .IcoNormal {
            float: left;
            border-bottom: 0px;
            border-left: 0px;
            background-color: transparent;
            width: 16px;
            height: 16px;
            vertical-align: middle;
            border-top: 0px;
            border-right: 0px;
            background-image: url(/dist/img/upload_normal.gif);
            background-repeat: no-repeat;
            float: left;
        }

        .progressobj {
            height: 20px;
        }

        .progressobj .delfile {
            float: left;
            margin-left: 10px;
        }

        .select {
            color: #fff;
            background-color: #045B9E;
        }

        td .sp-value {
            display: inline-block;
            padding-left: 6px;
            word-wrap: break-word;
        }

        td {
            color: #2a8cec;
        }

        td.td-title, td .filename, td.td-module {
            color: black;
        }

        .table-detail-payee:nth-child(even) td.td-title {
            background-color: white;
        }

        .printDiv {
            display: none;
        }
        .imgStyle{
            width: 250px;
            height: 250px;
        }
        .input-sm {
            height: 24px;
            padding: 5px 10px;
            font-size: 12px;
            line-height: 24px;
            border-radius: 0px;
        }
        .td-value span.lineOne {
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            max-height: 48px;
            line-height: 24px;
            height: 24px;
        }
        .td-value {
            text-align: left !important;
            vertical-align: middle;
            word-wrap: break-word;
            color: #2a8cec !important;
        }

        .td-value span {
            display: inline-block;
            max-height: 56px;
            overflow: hidden;
            padding: 0 6px;
            word-wrap: break-word;
        }

        .td-value1 {
            text-align: center !important;
            vertical-align: middle;
            word-wrap: break-word;
            color: #2a8cec !important;
        }

        .td-value1 input {
            text-align: center;
        }

        select {
            padding-left: 10px;
            color: rgb(42, 140, 236);
            text-align: center;
            text-align-last: center;
            color: #2a8cec;
        }
        .lineOne {
            max-height: 36px;
            line-height: 18px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
        }
    </style>
</head>
<body >
<section  style="padding-left:0px;" id="app" v-cloak>
<div class="oaLoad">
    <div class="loadGif" id="areaProgress"></div>
</div>
<div class="div-td-content-more"><i></i></div>
<iframe id="ifAttach" style="display:none"></iframe>
<div class="layout" style="left:0px;top:0px;right:0px;bottom:0px;" >

    <div class="center" style="overflow:auto;overflow-x:hidden;padding-left:8px;padding-right:8px;">
        <table class="table-detail">
            <tr class="no-print">
                <td colspan="4" class=" no-print td-module" style="background: yellow">基本信息</td>
            </tr>
            <tr>
                <td style="width:25%;" class="td-title">姓名</td>
                <td style="width:25%;" class="td-value1">
                    <span class="oa-name">{{list.main.createUserName}}</span>
                </td>
                <td style="width:25%;" class="td-title">日期</td>
                <td style="width:25%;" class="td-value1">
                    <span>{{list.main.reportDate}}</span>
                </td>
            </tr>
            <tr >
                <td style="width:25%;" class="td-title">费用名称</td>
                <td style="width:25%;" class="td-value1">
                    <span>{{list.main.costSmallName}}</span>
                </td>
                <td style="width:25%;" class="td-title">金额(元)</td>
                <td style="width:25%;" class="td-value1">
                    <input v-if="pageType=='edit'" v-model="list.main.money" class="form-control pull-left input-sm" style="color: #2a8cec" type="text">
                    <span v-else>{{list.main.money}}</span>
                </td>
            </tr>
            <tr>
                <td style="width:25%;" class="td-title">是否有发票</td>
                <td style="width:25%;" class="td-value1">
                    <select  v-model="list.main.invoiceFlag" v-if="pageType=='edit'">
                        <option value="0" :selected="list.main.invoiceFlag=='0'?'selected':''">
                            无
                        </option>
                        <option value="1" :selected="list.main.invoiceFlag=='1'?'selected':''">
                            有
                        </option>
                    </select>
                    <span v-else>{{list.main.invoiceFlag==0?'无':'有'}}</span>
                </td>
                <td style="width:25%;" colspan="2">
                </td>
            </tr>
            <tr>
                <td class="td-title">备注</td>
                <td colspan="3" style="text-align: left !important;">
                    <textarea style="padding-left: 10px !important;" v-if="pageType=='edit'" v-model="list.main.remark" ></textarea>
                    <span v-else class="lineOne" style="padding-left: 10px !important;display: block">{{list.main.remark}}</span>
                </td>
            </tr>
        </table>
        <table class="table-detail" v-if="list.main.auditFlag==1&&list.main.invoiceFlag=='0'">
            <tr class="no-print">
                <td colspan="4" class=" no-print td-module" style="background: yellow">抵票信息</td>
            </tr>
            <tr>
                <td style="width:25%;" class="td-title" colspan="2">抵票名称</td>
                <td class="td-title" style="width:25%;" colspan="2">抵票金额</td>
            </tr>
            <tr v-for="(item2,i2) in rushMoneyList">
                <td style="text-align: center !important;" colspan="2">
                    <select v-if="pageType=='edit'" v-model="item2.costSmallId" @change="changeCostName(item2,i2)">
                        <option value="">请选择</option>
                        <option v-for="expense in expensesList" v-bind:value="expense.id">{{expense.name}}
                    </select>
                    <span v-else style="text-align: center"> {{item2.costSmallName}}</span>
                </td>
                <td style="color: #2a8cec;text-align: center !important;" colspan="2">
                    <input v-if="pageType=='edit'"  class="payeeName" type="text" v-model="item2.rushOffMoney">
                    <span v-else> {{item2.rushOffMoney}}</span>
                </td>
            </tr>
        </table>
        <table class="table-detail">
            <tr class="no-print">
                <td colspan="4" class=" no-print td-module" style="background: yellow">审批进度</td>
            </tr>
            <tr>
                <td style="width:25%;" class="td-title">审核人</td>
                <td style="width:25%;" class="td-title">审核状态</td>
                <td style="width:25%;" class="td-title">审核时间</td>
                <td style="width:25%;" class="td-title">审核意见</td>
            </tr>
            <tr>
                <td style="width:25%;" class="td-value1">
                   <!-- <span>{{list.main.currentAuditorName}}</span>-->
                    <span >{{getRoleName(list.auditors.auditorName,list.auditors.auditorId)}}</span>
                </td>
                <td class="td-value1" style="width:25%;">
                    <span style="color: red" v-if="list.main.auditFlag=='0'">待审核</span>
                    <span v-if="list.main.auditFlag=='1'">通过</span>
                    <span v-if="list.main.auditFlag=='2'">驳回</span>
                </td>
                <td style="width:25%;" class="td-value1">
                    <span v-if="pageType=='audit'">{{defaultAuditTime}}</span>
                    <span v-else>{{list.auditors.auditTime}}</span>
                </td>
                <td style="width:25%;" class="td-value">
                    <input style="color: #2a8cec" v-if="pageType=='audit'" v-model="list.auditors.auditAdvise" class="pull-left form-control pull-left input-sm" type="text">
                    <span v-else class="lineOne">{{list.auditors.auditAdvise}}</span>
                </td>
            </tr>
            <!--<tr v-if="list.main.copierReturnReason&&list.main.auditFlag=='2'">-->
                <!--<td class="td-title">抄送人驳回</td>-->
                <!--<td colspan="3" style="text-align: left;">-->
                    <!--<span class="sp-value">{{list.main.copierReturnReason}}</span>-->
                <!--</td>-->
            <!--</tr>-->
            <!--<tr v-if="list.main.copierReturnReason==''&&list.auditors.auditFlag=='2'">-->
                <!--<td class="td-title">驳回原因</td>-->
                <!--<td colspan="3" style="text-align: left;">-->
                    <!--<span class="sp-value">{{list.auditors.auditAdvise}}</span>-->
                <!--</td>-->
            <!--</tr>-->
        </table>
        <div class="south no-print"  style="height: 50px; line-height: 50px; text-align: center;"
             v-if="currentUser.id==list.main.currentAuditorId&&pageType=='audit'">
            <input type="button" value="通过" class="btn oaBtn btn-sm" style="margin-left: 20px;" @click="applyAudit('1')">
            <input type="button" value="驳回" class="btn oaBtn btn-sm" style="margin-left: 20px;" @click="applyAudit('2')">
        </div>
        <div class="south no-print"  style="height: 50px; line-height: 50px; text-align: center;"
             v-if="currentUser.id==list.main.createUserId&&pageType=='edit'&&list.main.auditFlag=='2'">
            <input type="button" value="重新提交" class="btn oaBtn btn-sm" style="margin-left: 5px;" @click="reSubmit()">
        </div>
    </div>

</div>
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=63aed32f"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<!--ztree组件所需js-->
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.exhide-3.5.js"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="/dist/js/pages/apply/money/class.js"></script>
<script type="text/javascript" src="/dist/js/pages/system/systemService.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/commonService.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/changeMoneyToChinese.js"></script>
<script type="text/javascript" src="/dist/plugins/print/print.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script src="/dist/js/pages/wreport/Template.js?t=42e28def"></script>
<script type="text/javascript">
    var api = frameElement.api, W = api.opener;

    function refresh() {

    }

    var app = new Vue({
        el: "#app",
        data: {
            rushMoneyList: [
            ],
            defaultAuditTime:'',
            currentUser:getCurrentUser(),
            pageType: $.wyui.page.urlParams.pageType,
            list: {
                auditors: {
                    auditAdvise: "",
                    auditFlag: "",
                    auditSort: 0,
                    auditTime: "",
                    auditorId: "",
                    auditorName: "",
                    auditorRoleName:"",
                    fkCostId: "",
                    id: ""
                },
                copiers: {
                    copyPersonId: "",
                    copyPersonName: "",
                    fkCostId: "",
                    id: ""
                },
                cost: {
                    afterOffice: "",
                    beforeOffice: "",
                    entertainmentVenue: "",
                    fkCostId: "",
                    guestNature: "",
                    guests: "6",
                    host: "1",
                    hotelName: "",
                    hotelTel: "",
                    id: "",
                    img: "",
                    license: "",
                    mileage: "",
                    officeMatters: "",
                    phone: "",
                    residence: "",
                    cohabitation: "",
                    restaurantName: "",
                    restaurantTel: "",
                    predictMoney: ""
                },
                main: {
                    auditFlag: "",
                    copierReturnReason: "",
                    costBigId: "",
                    costBigName: "",
                    costSmallId: "",
                    costSmallName: "",
                    createUserId: "",
                    createUserName: "",
                    currentAuditorId: "",
                    currentAuditorName: "",
                    id: "",
                    invoiceFlag: "",
                    money: 0.00,
                    remark: "",
                    reportDate: "",
                    start: "",
                    wid: ""
                }
            },
        },
        methods: {
            showDatePicker: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.searchParams.beginTime = dp.cal.getNewDateStr();
                        return true;
                    },
                    //dateFmt:'yyyy-MM-dd HH:mm'
                });
                $(e.target).blur();
            },
            // audit:function (flag) {
            //     var that = this
            //     $.wyui.postLoadMethod("/wreportCost/applyAuditCost.json", {
            //         auditFlag:flag,
            //         costId:that.list.main.id,
            //         auditAdvise:that.list.auditors.auditAdvise,
            //         costAuditId:that.list.auditors.id,
            //         auditUserId:that.list.auditors.auditorId,
            //     }, function (r) {
            //         var $iframe = top.findIframeByName("费用报销（新）");
            //         $iframe[0].contentWindow.$("#iframeBox")[0].contentWindow.app.getList();
            //         api.close();
            //     }, false, true)
            // },
            //提示弹框
            showModel: function (width, title) {
                parent.$.alert({type:'topAlert',width:width,title:title})
            },
            applyAudit: function (auditFlag) {
                var that = this;
                if (auditFlag == '1') {
                    that.list.auditors.auditAdvise='同意！'
                    top.$.alert({
                        win: this,
                        height: 180,
                        width: 300,
                        icon: '3', //1成功 2失败 3提示 不传代表无图标
                        title: '确定要通过吗？',
                        blankclose: true,//点击空白是否可关闭
                        ok: "通过",//是否显示确认按钮,
                        okCallback: function (em, opts) {
                            //确认按钮回调
                            em.remove()
                            opts.close && opts.close()
                            $.wyui.postLoadMethod("/wreportCost/applyAuditCost.json", {
                                auditFlag:auditFlag,
                                costId:that.list.main.id,
                                auditAdvise:that.list.auditors.auditAdvise,
                                costAuditId:that.list.auditors.id,
                                auditUserId:that.list.auditors.auditorId,
                            }, function (r) {
                                var $iframe = top.findIframeByName("费用报销");
                                $iframe[0].contentWindow.$("#iframeBox")[0].contentWindow.app.getList();
                                setTimeout(function () {
                                    api.close();
                                }, 1000);
                                that.showModel(200, "审核成功")
                            }, false, true)
                        },
                        cancel: "取消",
                        cancelCallback: function (em, opts) {
                            em.remove()
                            opts.close && opts.close()
                        }
                    })
                } else if (auditFlag == '2') {
                    this.copierReturn(1,'2')
                    return;
                }
            },
            getRoleName:function (name,id) {
                var roleName= "";
                if (id){
                    $.wyui.postLoadMethod(urlConfig.system.user.getUserViewById, {id: id}, function (r) {
                        console.log(r);
                        roleName = r.roleName;
                    }, true, false);
                }
                console.log(name + roleName)
                return  name+"-"+roleName
            },
            copierReturn: function (type,auditFlag) {
                var that =this
                //type : 0-抄送人驳回  1-审核人驳回
                $.dialog({
                    content: 'url:copierReturnReason.html?id=' + that.list.main.id + "&t=" + new Date() + "&type=" + type + "&auditFlag=" + auditFlag,
                    title: '驳回',
                    width: 300,
                    height: 250,
                    max: false,
                    min: false,
                    lock: true
                });
            },
            getNowDate: function () {
                var now = new Date();
                var year = now.getFullYear();
                var month = (now.getMonth() + 1).toString();
                var day = (now.getDate()).toString();
                var hour = (now.getHours()).toString();
                var minute = (now.getMinutes()).toString();
                var second = (now.getSeconds()).toString();
                if (month.length == 1) {
                    month = "0" + month;
                }
                if (day.length == 1) {
                    day = "0" + day;
                }
                if (hour.length == 1) {
                    hour = "0" + hour;
                }
                if (minute.length == 1) {
                    minute = "0" + minute;
                }
                if (second.length == 1) {
                    second = "0" + second;
                }
                var dateTime = year + "-" + month + "-" + day;
                return dateTime;
            },
            reSubmit:function () {
                var that = this
                $.wyui.postMethod("/wreportCost/updateCostDetailByCostId.json", {
                    costId:that.list.main.id,
                    currentUserId:that.list.main.createUserId,
                    money:that.list.main.money,
                    remark:that.list.main.remark,
                    invoiceFlag:that.list.main.invoiceFlag,
                    costSmallName:that.list.main.costSmallName,
                }, function (r) {
                    var $iframe = top.findIframeByName("费用报销");
                    $iframe[0].contentWindow.$("#iframeBox")[0].contentWindow.app.getList();
                    api.close();
                })
            }
        },
        mounted: function () {
            var that=this;
            that.defaultAuditTime=that.getNowDate();
            var arr;
            $(".oaLoad").show();
            $.wyui.postMethod("/wreportCost/getCostDetailByCostId.json",{
                costId:$.wyui.page.urlParams.id
            }, function (r) {
                console.log(r)
                that.list.main=r.costList;
               if(r.costAuditList&&r.costAuditList.length>0){

                   that.list.auditors=r.costAuditList[0];
               }

                that.rushMoneyList=r.costRushList;
//                that.list.auditors = r.auditors[0];
//                that.lc=r.cost.afterOffice-r.cost.beforeOffice;
//                if(r.cost.img){
//                    arr=r.cost.img.split(",");
//                }else{
//                    arr=[];
//                }
//                that.imglist=arr;
//                console.log(that.imglistss,that.list.main.costSmallId)
//                that.copierslist = r.copiers;
                $(".oaLoad").hide();
            })


        }
    });
</script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
</body>
</html>